<?php
class Block_Core_Form_Element_Select
    extends Block_Core_Form_Element_Abstract
{
    public function toHtml()
    {
        $html = '<p><span';
        if($this->getRequired()) {
            $html .= ' class="req"';
        }
        $html .= '>';
        $html .= $this->getComment().'</span>';

        $html .= '<label>'.$this->getLabel();
        if($this->getRequired()) {
            $html .= ' <span>(Required Field)</span>';
        }
        $html .= '</label>';

        $html .= '<select class="field size1 '.$this->getClass().'"';
        $html .= 'name="'.$this->getName().'" title="'.$this->getTitle().'"';
        $html .= 'value="'.$this->getValue().'" id="'.$this->getId().'">';
        $html .= '<option value="">--Please select--</option>';

        foreach ($this->getParams() as $_item) {
            $html .= '<option value="'.$_item['value'].'"';
            if($_item['value']==$this->getValue()) {
                $html .=' selected ';
            }
            $html .=' >'.$_item['label'].'</option>';
        }

        $html .= '</select>';
        $html .= '</p>';

        return $html;
    }
}